import cv2,os,time,datetime
import numpy as np
from time import sleep

class CamaroCap(object):

    def __init__(self):

        self.cap = cv2.VideoCapture(0)
        self.cap.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))
        self.cap.set(cv2.CAP_PROP_FPS, 120)
        self.cap.set(cv2.CAP_PROP_FRAME_WIDTH, 320)
        self.cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 240)
        self.m = self.cap.get(cv2.CAP_PROP_FOURCC)
        self.f = self.cap.get(cv2.CAP_PROP_FPS)


    def get_image_info(self,image):
        print(self.f)
        print(self.m)
        #print(type(image))
        #print(image.shape)
        #print(image.size)
        #print(image.dtype)
        #pixel_data = np.array(image)
        #print(pixel_data)


    def Camaro_image(self):
        i = 0
        while(True):
            ret,frame = self.cap.read()
            if ret == False:
                break

            self.get_image_info(frame)

            cv2.imshow('capture',frame)

            #mtime = datetime.datetime.now().strftime('%Y-%m-%d_%H_%M_%S')
            #print(mtime)

            #cv2.imwrite(r"D:\image\\" + str(i) + str("-") + mtime + ".jpg",frame)
            #cv2.imwrite(r"image"+str(i),frame)
            #sleep(5)
            #i = i + 1

            if cv2.waitKey(1) & 0xFF == ord('q'):
                break

if __name__ == '__main__':

    outmasages = CamaroCap()

    outmasages.Camaro_image()

    outmasages.cap.release()
    cv2.destroyAllWindows()



